{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "reverse-christmas",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "import mglearn\n",
    "from sklearn.datasets import load_breast_cancer\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.neighbors import KNeighborsClassifier"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "flexible-sheriff",
   "metadata": {},
   "source": [
    "## 导入数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "contrary-continent",
   "metadata": {},
   "outputs": [],
   "source": [
    "cancer = load_breast_cancer()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "marked-fifteen",
   "metadata": {},
   "source": [
    "## 划分数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "compliant-shakespeare",
   "metadata": {},
   "outputs": [],
   "source": [
    "X_train, X_test, y_train, y_test = train_test_split(cancer.data, cancer.target, random_state=66)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "several-toddler",
   "metadata": {},
   "source": [
    "## 创建模型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "durable-enough",
   "metadata": {},
   "outputs": [],
   "source": [
    "clf = KNeighborsClassifier(n_neighbors=3)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "vietnamese-elements",
   "metadata": {},
   "source": [
    "## 训练模型"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "postal-porcelain",
   "metadata": {},
   "outputs": [],
   "source": [
    "training_accuracy = []\n",
    "test_accuracy = []\n",
    "# n_neighbors的取值从1到10\n",
    "neighbors_settings = range(1, 11)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "flying-raise",
   "metadata": {},
   "outputs": [],
   "source": [
    "for n_neighbors in neighbors_settings:\n",
    "    clf = KNeighborsClassifier(n_neighbors=n_neighbors)\n",
    "    clf.fit(X_train, y_train)\n",
    "    # 记录训练集精度\n",
    "    training_accuracy.append(clf.score(X_train, y_train))\n",
    "    # 记录泛化精度\n",
    "    test_accuracy.append(clf.score(X_test, y_test))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "divine-robertson",
   "metadata": {},
   "source": [
    "## 画图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "extensive-scene",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.legend.Legend at 0x7f0ea3e51cd0>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEHCAYAAAC0pdErAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAA0vUlEQVR4nO3dd3zV9fX48dfJIgTCyGAGCHuGMAIyZAgyXKjgAhS1Cu6v1uqvWttqaa22Ure2ikUFF4gDrQuQraCEKTMJO8wECIQRIMn5/fG5iQEuIST35pNxno9HHrn3M8+9hHvue4uqYowxxpwpwO0AjDHGlE2WIIwxxnhlCcIYY4xXliCMMcZ4ZQnCGGOMV0FuB+ArUVFRGhsb63YYxhhTrixbtixdVaO97aswCSI2NpbExES3wzDGmHJFRLada59VMRljjPHKEoQxxhivLEEYY4zxqsK0QRhjiufUqVOkpqaSlZXldijGj0JDQ4mJiSE4OLjI51iCMKaSS01NJTw8nNjYWETE7XCMH6gq+/fvJzU1laZNmxb5PL9VMYnIJBHZJyJrzrFfRORlEUkRkdUi0qXAvltFJNnzc6u/YjTGQFZWFpGRkZYcKjARITIy8oJLif5sg3gHGFrI/suAlp6fccC/AUQkAngSuAjoDjwpIrX9GKcxlZ4lh4qvOP/GfksQqroAOFDIIVcDk9WxBKglIvWBIcAsVT2gqgeBWRSeaEok61QO7/64lV0Zx/11C2OMK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EcYMNdTDSXAvZYcTHljJQhT6YnIazir+hX0kqq+7UY8xpQVliCMMcZ4Zb2YjDHGeGUJwhhjjFeWIIwxxnhlCcIYY4xX/x9uoCWeXnQ7DgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.plot(neighbors_settings, training_accuracy, label=\"training accuracy\")\n",
    "plt.plot(neighbors_settings, test_accuracy, label=\"test accuracy\")\n",
    "plt.xlabel(\"n_neighbors\")\n",
    "plt.ylabel(\"Accuracy\")\n",
    "plt.legend()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "smart-railway",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "subsequent-philippines",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "vietnamese-romantic",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  },
  "nbTranslate": {
   "displayLangs": [
    "*"
   ],
   "hotkey": "alt-t",
   "langInMainMenu": true,
   "sourceLang": "en",
   "targetLang": "fr",
   "useGoogleTranslate": true
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
